package com.hngy.xpq.broadcastdemo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver {
    private static final String action1="zuckerberg";//声明第一个动作
    private static final String action2="mahuateng";   //声明第二个动作
    @Override
    public void onReceive(Context context, Intent intent) {
                if(intent.getAction().equals(action1)){
                    Toast.makeText(context, "MyReceiver收到:zuckerberg的广播",
                            Toast.LENGTH_SHORT).show(); //回复该动作收到广播
                }else if (intent.getAction().equals(action2)){
                    Toast.makeText(context, "MyReceiver收到:mahuateng的广播",
                            Toast.LENGTH_SHORT).show();//回复该动作收到广播
                }

    }
}
